.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\"
.\"     @(#)pkg.8
.\"
.Dd May 25, 2014
.Dt PKG-ADD 8
.Os
.Sh NAME
.Nm "pkg add"
.Nd Registers a package and installs it on the system
.Sh SYNOPSIS
.Nm
.Op Fl IAfMq
.Ar pkg-name ...
.Nm
.Op Fl IAfMq
.Ar <protocol>://<path>/<pkg-name> ...
.Pp
.Nm
.Op Cm --{no-scripts,automatic,force,accept-missing,quiet}
.Op Cm --relocate Ar location
.Ar pkg-name ...
.Nm
.Op Cm --{no-scripts,automatic,force,accept-missing,quiet}
.Op Cm --relocate Ar location
.Ar <protocol>://<path>/<pkg-name> ...
.Sh DESCRIPTION
.Nm
installs packages from either a local source or a remote one.
.Pp
When installing from a remote source you need to specify
the protocol to use when fetching the package.
.Pp
Currently supported protocols are FTP, HTTP and HTTPS.
.Pp
Otherwise,
.Nm
will read the file named on the command line.
.Pp
If this is a regular file, and the package to be installed has
unmet dependencies,
.Nm
will search the directory containing
.Ar pkg-name
for suitable pkg archive files to fulfill those dependencies.
If
.Ar pkg-name
is literally
.Pa -
then it will read the package data from stdin.
.Nm
will automatically detect and unpack most common compression formats
based on the content of the data stream it reads, ignoring any
extension the filename may have.
.Pp
If this involves reading from a pipe (including
.Pa stdin ) ,
fifo, socket or some other non-regular form of input stream then
.Nm
will immediately emit an error if
.Ar pkg-name
has unmet dependencies.
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width automatic
.It Fl A , Cm --automatic
Mark the installed packages as automatic.
Will be automatically removed if no other packages depend on them.
For more information please refer to
.Xr pkg-autoremove 8 .
.It Fl f , Cm --force
Force the reinstallation of the package if already installed.
.It Fl I , Cm --no-scripts
If any installation scripts (pre-install or post-install) exist for given
packages, do not execute them.
.It Fl M , Cm --accept-missing
Force the installation of the package with missing dependencies.
.It Fl q , Cm --quiet
Force quiet output.
.It Cm --relocate Ar location
Annotates the package as having been relocated to
.Pa location ,
which is an alternate system root.
This is an experimental feature and intended for cross-architecture
package management.
There is no corresponding single letter option.
.Pq DEPRECATED
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for further description.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev DEFAULT_ALWAYS_YES
.It Ev ASSUME_ALWAYS_YES
.It Ev HANDLE_RC_SCRIPTS
.It Ev PKG_DBDIR
.El
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-lock 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8
